[XENBUS] Cleanup correctly on suspend, unregister watches.
authorkaf24@localhost.localdomain <kaf24@localhost.localdomain>
Sat, 19 Aug 2006 09:21:02 +0000 (10:21 +0100)
committerkaf24@localhost.localdomain <kaf24@localhost.localdomain>
Sat, 19 Aug 2006 09:21:02 +0000 (10:21 +0100)
Again needed for domU kexec, so the next kernel instance can register
watches without running into -EBUSY.

Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c

index d7f6793d482e9c3fc415019723aa25b03ca06f68..190fa1e794f5f9480b26ef770998405c58b83f89 100644 (file)
@@ -665,7 +665,17 @@ EXPORT_SYMBOL_GPL(unregister_xenbus_watch);
 
 void xs_suspend(void)
 {
+       struct xenbus_watch *watch;
+       char token[sizeof(watch) * 2 + 1];
+
        down_write(&xs_state.suspend_mutex);
+
+       /* No need for watches_lock: the suspend_mutex is sufficient. */
+       list_for_each_entry(watch, &watches, list) {
+               sprintf(token, "%lX", (long)watch);
+               xs_unwatch(watch->node, token);
+       }
+
        mutex_lock(&xs_state.request_mutex);
 }